<!-- POR DJ  -->
{php}
include "ad_get.php";
$this->assign('estoyEnFrontPage',$categories[0].CATFATHERID!=1);
{/php}

{if !$parentCatid}
{assign var=extraStyle value='frontPage'}
{/if}
<div style="clear:both;"></div>
{if $categories}
	<div class="categorias-container" style="width:760px;">
{if $front }  <div class="titulo"> {else} <div class="titulo_largo"> {/if}	
		{if !$parentCatid and !$showAll}
		<div style="float: right">
			<span style="margin-right: 0px;">
				<a href="index.php?catid={$mainCat}&showAll=1#tabs-{$tabSelected}" style="text-decoration:none; cursor: pointer; color:#FFFFFF; padding-right:10px; font-stretch:condensed;">VER + CATEGORIAS</a>
			</span>
		</div>
		{/if}
		<div style="float:left">	
			<h3 style="font-weight:normal; font-stretch:condensed;">//{if $catname}
					{$catname}
				{else}
					{if $parentCatid}
						SUB	
					{/if}
					{$smarty.const.LA_CATEGORIES}
				{/if}
			</h3>
		</div>
	</div>
	{if $options}		
		<div style="float:right"> 
				<form method="get">
						<select name="region" onchange="submit();">
								<option value="-1">{$smarty.const.LA_REGION_CHOOSE_FIRST}</option>
								 {$options}
						 </select>
				</form>
		</div>
	{/if}
	<!-- JMR: PATH Category -->
	<span class="P66" >{$categoryPath}</span>	
				
           {if $front==0}
                <div class="listing-type-grid2 catalog-listing {if $front==0 } cajasCategoriasbig{/if}">
                    <table class="cat-two-cols" cellspacing=0 cellpadding=0 width="100%">
                    <tr><td style="padding-bottom:15px">
             
                    {assign var=li_count value=1 }
                    {assign var=li_limit value=`$total_count/2`}
                    <ol class="grid-row odd {$extraStyle}" style="float:left" id="ol_cat_1">
                    
                    {foreach name=main item=category from=$categories}		
                        {assign var='li_count' value=$li_count+1}
                        <li class="category_none item {$extraStyle}" valign="top" id="{$category.CATEGORYNAME}_li">
                        {$category.URL}<strong> {$category.CATEGORYNAME} ({$category.TOTAL_ADS})</strong></a>                            
                             {if $category.SUBCATLIST}
                                 <div class="sub_cat_small {$extraStyle}">
                                    {assign var=count value=0 }
                                    {foreach name=sub item=sub from=$category.SUBCATLIST}
                                    {if $count==15 }
                                        <label class="ver_mas_cat" style="color:#DB3928; font-size:11px; font-stretch:condensed;" OnClick="javascript:this.style.display = 'none';hideUnhideElementById('{$category.CATEGORYNAME}_vermas');changeHeightById('ol_cat_{$ol_count}')"><br />| VER MAS |+</label>
                                        <div style="display:none" id="{$category.CATEGORYNAME}_vermas">
                                    {/if}
                                        <a href="{$sub.CATLINK}" title="{$sub.CATNAME_FULL}" style="color:#58595B">{$sub.CATNAME}</a>
                                        <small class="littleGray">&nbsp;{$sub.NUM}</small>{if !$smarty.foreach.sub.last},<br />{/if}
                                    {assign var='li_count' value=$li_count+1}
                                    {/foreach}
                                    {if $count> 14 }					
                                        </div>
                                    {/if}
                                </div>
                            {elseif $category.CATDESCRIPTION}
                                <small>{$category.CATDESCRIPTION}</small>
                            {/if}
                        </li>
                        {if $li_count > $li_limit}
                            {assign var=li_count value=0}
                            </ol>
                            <ol class="grid-row odd {$extraStyle}" style="float:left" id="ol_cat_1">
                        {/if}		
                    {/foreach}
                    </ol>
                    </td></tr>
                    </table>
                </div>

           {else}
                <div class="listing-type-grid catalog-listing {if $front==0 } cajasCategorias{/if}"> 
    
                    {if $front==0  && 1==2}
                    <table cellspacing="0" cellspacing="0" width="747" align="center" style="background-image:url(layout_images/new/categories_middle.jpg); background-repeat:repeat-y;">
                    <tr><td><img src="layout_images/new/categories_top.jpg" align="left" /></td></tr>
                    <tr><td valign="top">
                    {/if}
                    
                    <ol class="grid-row odd {$extraStyle}" id="ol_cat_1">
                    <input type="hidden" value="0" id="hi_ol_cat_1" />
                    {assign var=ol_count value=1 }	 
                    {foreach name=main item=category from=$categories}		
                        <li width="{$TD_SIZE}%" class="ui-tabs ui-widget ui-widget-content ui-corner-all category_none item {$extraStyle}" valign="top" id="{$category.CATEGORYNAME}_li">
                            <img src="catimages/{$category.IMAGE}" alt="" hspace="2" style="width:35px; float: right;" />
            
                        <div class="main_cat {$extraStyle}" style="padding-left:10px; padding-bottom:12px;">
                        {$category.URL}<strong> {$category.CATEGORYNAME} ({$category.TOTAL_ADS})</strong></a>
                        </div>
                            
                         {if $category.SUBCATLIST}
                         <div class="sub_cat_small {$extraStyle}">
                            {assign var=count value=0 }
                            {foreach name=sub item=sub from=$category.SUBCATLIST}
                            {assign var=count value=$count+1 }
                            {if $count==15 }
                                <label class="ver_mas_cat" style="color:#DB3928; font-size:11px; font-stretch:condensed;" OnClick="javascript:this.style.display = 'none';hideUnhideElementById('{$category.CATEGORYNAME}_vermas');changeHeightById('ol_cat_{$ol_count}')"><br />| VER MAS |+</label>
                                <div style="display:none" id="{$category.CATEGORYNAME}_vermas">
                            {/if}
                                <a href="{$sub.CATLINK}" title="{$sub.CATNAME_FULL}" style="color:#58595B">{$sub.CATNAME}</a>
                                <small class="littleGray">&nbsp;{$sub.NUM}</small>{if !$smarty.foreach.sub.last},<br />{/if}
                            {/foreach}
                            {if $count> 14 }					
                                </div>					
                            {/if}
                            </div>
                        {elseif $category.CATDESCRIPTION}
                            <small>{$category.CATDESCRIPTION}</small>
                        {/if}
                        </li>
                        
                        {if $category.BREAK && !$smarty.foreach.main.last && !$parentCatid}
                            </ol>
                            {assign var=ol_count value=$ol_count+1 }
                            <ol class="{cycle values="alt,"} grid-row {$extraStyle}" id="ol_cat_{$ol_count}">
                            <input type="hidden" value="0" id="hi_ol_cat_{$ol_count}" />
                            
                        {/if}			
                                
                    {/foreach}
                    
                    </ol>
    
                    {if $front==0 && 1==2 }
                    </td></tr>
                    <tr><td><img src="layout_images/new/categories_bottom.jpg" /></td></tr>
                    </table>
                    {/if}
                
                </div>
		{/if}                
</div>  
{/if}
